package Calculate_Area;

public class Test {
    public static void main(String[] args) {
    PassObject po = new PassObject();
    Circle c = new Circle();
    po.printAreas(c,5);
    }
}

//定义圆Circle类，属性：double型半径r，findArea()方法返回圆的面积
class Circle{
    double r;
    public double findArea(){
        return Math.PI * r * r;
    }

    public void setR(int i){
        this.r = i;
    }
}
//定义类PassObject,定义方法printAreas(),public void printAreas(Circle c,int times)
//printAreas方法中输出1到times之间每个整数的半径值，以及对应面积
class PassObject{
    public void printAreas(Circle c,int times){
        System.out.println("半径 \t面积");
        for (int i = 1; i <= times ; i++) {
            c.setR(i);
            System.out.println((double)i + " \t " + c.findArea());
        }
    }
}
